package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type User struct {

	Name string `form:"name" binding:"required,len=4"`
	Age int `form:"age" binding:"numeric,min=1,max=100"`
}

func main(){
	engine := gin.Default()
	engine.GET("/get", func(c *gin.Context) {
		var user User
		err := c.ShouldBind(&user)
		if err != nil {
			c.String(http.StatusOK,err.Error())
		}else{
			c.String(http.StatusOK,"name -> %s age -> %d",user.Name,user.Age)
		}
	})
	engine.Run()
}
